import Mock from "mockjs";

const { data } = Mock.mock({
  // 20条数据
  "data|20": [
    {
      //商品图片
      goodsImg: "@Image('150x60','@color','好鞋')",
      //商品名称
      "goodsName|1": [
        "乔丹Jordan",
        "耐克NIKE",
        "阿迪达斯Adidas",
        "AJ低帮藤原浩闪电",
        "DUNK SB黑白熊猫",
        "OW联名鞋",
      ],
      //单价
      "goodsSale|300-500": 300,
      // 数量
      goodsNum: 1,
      // 订单编号
      "itemNum|1000000000000-9999999999999": 100000000000,
      // 日期
      goodsDate: "20220-08-26 16:15",
      // 买家信息
      nickname: "@cname",
      // 商品Id
      "goodsId|+1": 1,
    },
  ],
});
interface ParamsType {
  page: number;
  size: number;
}

class ProductServe {
  getData({ page, size }: ParamsType) {
    return new Promise((resolve) => {
      const result = data.slice((page - 1) * size, page * size);
      resolve({
        status: 0,
        result: result,
        count: data.length,
      });
    });
  }
}

const allorder = new ProductServe();
export default allorder;
